package com.yanfan.zutai.service.impl;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import com.yanfan.zutai.domain.BShortMessage;
import com.yanfan.zutai.mapper.BShortMessageMapper;
import com.yanfan.zutai.service.IBShortMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 短信分配Service业务层处理
 *
 * @author ruoyi
 * @date 2022-06-10
 */
@Service
public class BShortMessageServiceImpl implements IBShortMessageService {
    @Autowired
    private BShortMessageMapper bShortMessageMapper;

    /**
     * 查询短信分配
     *
     * @param id 短信分配主键
     * @return 短信分配
     */
    @Override
    public BShortMessage selectBShortMessageById(Long id) {
        return bShortMessageMapper.selectBShortMessageById(id);
    }

    /**
     * 查询短信分配列表
     *
     * @param bShortMessage 短信分配
     * @return 短信分配
     */
    @Override
    public List<BShortMessage> selectBShortMessageList(BShortMessage bShortMessage) {
        return bShortMessageMapper.selectBShortMessageList(bShortMessage);
    }

    /**
     * 新增短信分配
     *
     * @param bShortMessage 短信分配
     * @return 结果
     */
    @Override
    public int insertBShortMessage(BShortMessage bShortMessage) {
        Snowflake snowflake = IdUtil.getSnowflake(6, 2);
        long id = snowflake.nextId();
        bShortMessage.setId(id);
        return bShortMessageMapper.insertBShortMessage(bShortMessage);
    }

    /**
     * 修改短信分配
     *
     * @param bShortMessage 短信分配
     * @return 结果
     */
    @Override
    public int updateBShortMessage(BShortMessage bShortMessage) {
        return bShortMessageMapper.updateBShortMessage(bShortMessage);
    }

    /**
     * 批量删除短信分配
     *
     * @param ids 需要删除的短信分配主键
     * @return 结果
     */
    @Override
    public int deleteBShortMessageByIds(Long[] ids) {
        return bShortMessageMapper.deleteBShortMessageByIds(ids);
    }

    /**
     * 删除短信分配信息
     *
     * @param id 短信分配主键
     * @return 结果
     */
    @Override
    public int deleteBShortMessageById(Long id) {
        return bShortMessageMapper.deleteBShortMessageById(id);
    }
}
